//------------Sonic CD Diag Platform Script-------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

//-------Aliases-------//
#alias 46: TYPE_DIAGPLATFORM


sub ObjectMain
	Object.Value5=Oscillation
	Object.Value5<<=1
	if Object.PropertyValue==1
		Object.Value5+=256
	endif
	Cos(Object.Value2,Object.Value5)
	Object.Value2*=6144
	Object.Value2+=Object.XPos
	Object.Value2&=-65536
	Object.Value2-=Object.Value1
	Cos(Object.Value4,Object.Value5)
	FlipSign(Object.Value4)
	Object.Value4*=Object.Value6
	Object.Value4+=Object.YPos
	Object.Value4&=-65536
	Object.Value4-=Object.Value3
endsub


sub ObjectPlayerInteraction
	TempValue0=Object.XPos
	Object.XPos=Object.Value1
	TempValue1=Object.YPos
	Object.YPos=Object.Value3
	PlayerObjectCollision(C_PLATFORM,-32,-9,32,12)
	if CheckResult==1
		Player.XPos+=Object.Value2
		Player.YPos+=Object.Value4
	endif
	Object.XPos=TempValue0
	Object.YPos=TempValue1
endsub


sub ObjectDraw
	Cos(Object.Value1,Object.Value5)
	Object.Value1*=6144
	Object.Value1+=Object.XPos
	Object.Value1&=-65536
	Cos(Object.Value3,Object.Value5)
	FlipSign(Object.Value3)
	Object.Value3*=Object.Value6
	Object.Value3+=Object.YPos
	Object.Value3&=-65536
	DrawSpriteXY(0,Object.Value1,Object.Value3)
endsub


sub ObjectStartup
	LoadSpriteSheet("R1/Objects.gif")
	SpriteFrame(-32,-16,64,32,101,109)
	ArrayPos0=32
	while ArrayPos0<1056
		if Object[ArrayPos0].Type==TypeName[DiagPlatform]
			if Object[ArrayPos0].PropertyValue>1
				Object[ArrayPos0].Value6=-6144
				Object[ArrayPos0].PropertyValue-=2
			else
				Object[ArrayPos0].Value6=6144
			endif
		endif
		ArrayPos0++
	loop
endsub

sub RSDK
	LoadSpriteSheet("Global/Display.gif")
	SetEditorIcon(Icon0,SingleIcon,-16,-16,32,32,1,143)
endsub
